/*
 * Created on 2006-8-16
 */
package indexing.grid;

/**
 * @author Wu Wei A CellID is an ID that uniquely identify a cell in a grid
 *         index.
 */
public class CellID {
	private int row_id; // row <-> ;y

	private int column_id; // column <-> x

	private int MAX_NUM_CELLS_PER_COORDINATE = 10000;

	public CellID(int columnID, int rowID) {
		this.column_id = columnID;
		this.row_id = rowID;
	}

	public boolean equals(Object e) {
		if (this ==e){
			return true;
		}
		if (e instanceof CellID) {
			CellID acid = (CellID) e;
			if (this.column_id == acid.column_id && this.row_id == acid.row_id) {
				return true;
			}
		}
		return false;
	}

	public int hashCode() {
		return this.column_id * MAX_NUM_CELLS_PER_COORDINATE + this.row_id;
	}

	public String toString() {
		return "(" + column_id + "," + row_id + ")";
	}

	public int getColumn_id() {
		return column_id;
	}

	public int getRow_id() {
		return row_id;
	}

}
